package com.zhang.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Api(tags = "角色实体类")
@Data
@NoArgsConstructor
@TableName("t_role")
public class RoleBean {

    @ApiModelProperty("角色id")
    @TableId(value = "pk_roleId",type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("角色名")
    @TableField(value = "r_name")
    private String name;

    @ApiModelProperty("权限集合")
    private List<PowerBean> powerBeans;

    public RoleBean(String name, List<PowerBean> powerBeans) {
        this.name = name;
        this.powerBeans = powerBeans;
    }

    public RoleBean(String name) {
        this.name = name;
    }

    public RoleBean(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "RoleBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", powerBeans=" + powerBeans +
                '}' + "\n";
    }
}
